Reflection .NET API
Programming Concepts / Handling Host Timing and Screen Redraw Issues
Handling Host Timing and Screen Redraw Issues

When developing applications that interact with hosts, you must account for potential delays from wait-dependent operations (such as connecting or sending a key). For these operations, your code must detect when the host finishes processing and is ready to receive more commands. If your code sends additional input before the host is ready, an error can result.

You can accommodate these delays by including a wait method in your code that helps you determine when the host is ready for input. The API includes a variety of wait-related methods that allow you to reliably program for wait-dependent operations. Each method addresses a specific timing-sensitive situation. Following is a list of wait-related methods and a description of how they handle different wait modes.

For more information about each method, see the Reflection.NET API Help (from the Help menu).

This method

For this host

Waits

WaitForHostSettle

IBM and OpenSystems

Until no activity has occurred in the host session for a specified amount of time (referred to as the settle time). Waiting one to two seconds is sufficient for most uses. The lower the settle time, the faster your application runs; the higher the settle time, the less chance there is for your application to send input before the host is ready. A workable settle time depends on the typical response time of your host application and on network speed.

WaitForCursor

IBM and OpenSystems

For the host cursor to move to a specified location. This is useful for host applications that change the cursor location from screen to screen, provided that you know what the cursor location will be.

WaitForControlKey

OpenSystems

For the specified Control key press.

WaitForIncomingData

OpenSystems

For any data to come from the host. The terminal keyboard is disabled while waiting.

WaitForString

IBM and
OpenSystems

Until a specified string received from the host appears on the screen. Although this is usually a reliable method of waiting, it is practical only in cases where you are sure of the sequence of host screens.

Wait

IBM and
OpenSystems

For the specified duration (in milliseconds).

WaitForText

OpenSystems

For the specified text to appear at the specified screen location.

WaitUntil

OpenSystems

Until the specified time